import { useUserStoreHook } from "/@/store/modules/user";
import { Directive } from "vue";

export const showbtn: Directive = {
  mounted(el, binding) {
    const { value } = binding;
    if (value) {
      const authId = value;

      const usreInfo = useUserStoreHook().userInfo;
      const hasAuth = usreInfo?.userId != authId;
      if (hasAuth) {
        el.style.opacity = 0;
        el.style.visibility = "hidden";
      }
    } else {
      throw new Error("删除按钮控制错误");
    }
  }
};
